{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import skimage.io as sio\n",
    "from skimage.transform import resize"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "for files in tqdm(list_images('D:\\\\Projects\\\\Alzhiemer\\'s Research\\\\Data1')):\n",
    "    image = sio.imread(files)\n",
    "    folder_name = files.split('\\\\')[-2]\n",
    "    file_name = files.split('\\\\')[-1]\n",
    "    image = resize(image, (28, 28), mode='constant')\n",
    "    if not os.path.exists('resized\\\\' + folder_name):\n",
    "        os.makedirs('resized\\\\' + folder_name)\n",
    "    sio.imsave('resized\\\\' + folder_name + '\\\\' + file_name + '.jpg', image)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
